- 
                Notifications
    
You must be signed in to change notification settings  - Fork 13.9k
 
Don't make tools responsible for checking unknown and renamed lints #80524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| 
          
 (rust-highfive has picked a reviewer for you, use r? to override)  | 
    
| 
           The job  Click to see the possible cause of the failure (guessed by this bot) | 
    
| 
           Something that is also important to mention: 
 
 So it doesn't mention, that the handling of missing lints has to be implemented by the tool. With this and the fact, that we know all the tools that implement tool lints, this change should be fine.  | 
    
| 
           So the CI error is because internal lints are only enabled in the  This makes the   | 
    
| 
           Oh well, this uncovered a whole new set of problems, that were silently ignored before:  Lines 1268 to 1271 in 8b002d5 
 But this results in build failures for other tools, that don't adhere to the rustc internal lints, like  Well, this is something for the new year. Have a great new years eve everyone 🎉  | 
    
          
 FWIW, adding  
 I don't quite understand this - I think to test it I would need  
 I'm happy to fix the lints for rustdoc, I would prefer to have them enabled anyway.  | 
    
| 
           
  | 
    
| 
           @GuillaumeGomez it's aimed at libstd, which is the whole point - your PR did nothing because rustc lints aren't applied to libstd currently. I'm ok with denying that lint specifically for std though.  | 
    
| 
           libstd and libcore to be exact. If it's denied for both of them then it's all good for me.  | 
    
          
 So Clippy has  The question then is if other tools want those internal lints.  | 
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me with nit addressed (and CI passing)
          
 So it turns out the issue is that  FYI @m-ou-se I'm going to change this to just be  There's a second question here which is why all rustc:: lints are not known when   | 
    
          
 Normally the fix for this is to add   | 
    
4d7dcbe    to
    5db673c      
    Compare
  
    | 
           @jyn514 Yeah, that lint is a bit of a weird one. It's mostly/only meant for   | 
    
          
 Oh it isn't because of the  We chose to (ab)use the  Clippy sets this flag in   | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
5db673c    to
    77b15c1      
    Compare
  
    | 
           Ahh, that makes sense. So to summary, this does the following things: 
 @flip1995 does all of that sound good? I think for 2 you'll want to deprecate/remove the clippy pass that currently checks for unknown lints - is that simple to do? Happy to do it myself if you let me know how.  | 
    
| 
           Yes, that sounds good to me. If everything in this PR works as expected, every error message in the test for   | 
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
f7a2a1f    to
    f333a05      
    Compare
  
    
      
        
              This comment has been minimized.
        
        
      
    
  This comment has been minimized.
It's not an internal lint: - It's not in the rustc::internal lint group - It's on unconditionally, because it actually lints `staged_api`, not the compiler This fixes a bug where `#[deny(rustc::internal)]` would warn that `rustc::internal` was an unknown lint.
f333a05    to
    c819a4c      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I'm curious to know why this changed. This is a bug fix, right, it should have given a warning before?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm? The order is just different. And it has the default weirdness with linting attributes, that it is duplicated for the first inner attribute.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, I misread. No need to change anything.
And it has the default weirdness with linting attributes, that it is duplicated for the first inner attribute.
Does this have an issue open? It seems worth fixing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know of an issue for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opened rust-lang/rust-clippy#6602.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it's just in a different order; at the bottom it shows that it emitted 8 errors previously and now it emits 9.
This copies the unknown_lints code clippy uses for its unknown_clippy_lints lint to rustc. The unknown_clippy_lints code is more advanced, because it doesn't suggest renamed or removed lints and correctly suggest lower casing lints.
This is now handled by unknown_lints
2e70434    to
    13728b8      
    Compare
  
    | 
           Alright, I think this is good to go! @bors r=flip1995,matthewjasper  | 
    
| 
           📌 Commit 13728b8 has been approved by   | 
    
| 
           ☀️ Test successful - checks-actions  | 
    
The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to adopt the canonical name, so we can continue to build without warnings.
The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to adopt the canonical name, so we can continue to build without warnings. This change was automatically generated using the following script: ```sh sd clippy::unknown_clippy_lints unknown_lints \ $(fd . --extension rs zebra*)` ```
The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to add the canonical name, so we can continue to build without warnings on nightly. But we also need to keep the old name, so we can continue to build without warnings on stable. And therefore, we also need to disable the "removed lints" warning, otherwise we'll get warnings about the old name on nightly. We'll need to keep this transitional clippy config until rustc 1.51 is stable.
The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to add the canonical name, so we can continue to build without warnings on nightly. But we also need to keep the old name, so we can continue to build without warnings on stable. And therefore, we also need to disable the "removed lints" warning, otherwise we'll get warnings about the old name on nightly. We'll need to keep this transitional clippy config until rustc 1.51 is stable.
The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to add the canonical name, so we can continue to build without warnings on nightly. But we also need to keep the old name, so we can continue to build without warnings on stable. And therefore, we also need to disable the "removed lints" warning, otherwise we'll get warnings about the old name on nightly. We'll need to keep this transitional clippy config until rustc 1.51 is stable.
The clippy unknown lints attribute was deprecated in nightly in rust-lang/rust#80524. The old lint name now produces a warning. Since we're using `allow(unknown_lints)` to suppress warnings, we need to add the canonical name, so we can continue to build without warnings on nightly. But we also need to keep the old name, so we can continue to build without warnings on stable. And therefore, we also need to disable the "removed lints" warning, otherwise we'll get warnings about the old name on nightly. We'll need to keep this transitional clippy config until rustc 1.51 is stable.
Previously, clippy (and any other tool emitting lints) had to have their
own separate UNKNOWN_LINTS pass, because the compiler assumed any tool
lint could be valid. Now, as long as any lint starting with the tool
prefix exists, the compiler will warn when an unknown lint is present.
This may interact with the unstable
tool_lintfeature, which I don't entirely understand, but it will take the burden off those external tools to add their own lint pass, which seems like a step in the right direction to me.ineffective_unstable_trait_implas an internal lintUNKNOWN_CLIPPY_LINTSpass (and make it a no-op)clippy::x' instead of 'unknown lint x'This is tested by existing clippy tests. When #80527 merges, it will also be tested in rustdoc tests. AFAIK there is no way to test this with rustc directly.